package com.newhope.eshop;

import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
import com.newhope.eshop.web.Interceptor.LoginHandlerInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@DubboComponentScan(basePackages = "com.newhope.eshop.web")
//@ComponentScan(basePackages = {"com.newhope.eshop.web","com.newhope.eshop.common"})
public class EshopWebApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(EshopWebApplication.class, args);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**").excludePathPatterns("");
    }
}
